﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;

using FbKPI.Model;
namespace FbKPI.Controller
{
    public class MethodDetailController : FbKPI.Controller.dbConnection.ConnectionClass
    {
        public List<MethodDetail> GetByMethodID(int MethodID)
        {
            List<MethodDetail> list = new List<MethodDetail>();

            SqlCommand command = new SqlCommand();
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "SP_MethodDetail_GetBy_MethodID";
            command.Parameters.Add("@MethodID", SqlDbType.Int).Value = MethodID;

            DataSet dx = GetTable(command);

            foreach (DataRow dr in dx.Tables[0].Rows)
            {
                MethodDetail obj = new MethodDetail();
                obj.MethodDetailID = Convert.ToInt32(dr["MethodDetailID"].ToString().Trim());
                obj.MethodID = Convert.ToInt32(dr["MethodID"].ToString().Trim());
                obj.MethodDtlName = dr["MethodDtlName"].ToString().Trim();

                list.Add(obj);
            }

            return list;
        }
    }
}